package org.jetlinks.pro.koudai.web;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.hswebframework.ezorm.rdb.mapping.defaults.SaveResult;
import org.hswebframework.web.authorization.annotation.Resource;
import org.hswebframework.web.authorization.annotation.SaveAction;
import org.jetlinks.pro.koudai.Services.TakedExperimentService;
import org.jetlinks.pro.koudai.Services.TakedQuestionService;
import org.jetlinks.pro.koudai.entity.TakedExperimentEntity;
import org.jetlinks.pro.koudai.entity.TakedQuestionEntity;
import org.jetlinks.pro.koudai.tenant.KoudaiAssetType;
import org.jetlinks.pro.tenant.AssetType;
import org.jetlinks.pro.tenant.crud.TenantCorrelatesAccessCrudController;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import javax.annotation.Nonnull;
import java.util.function.Function;

@RestController
@RequestMapping("/taked-question")
@Resource(id = "taked-question-manager", name = "在做试题管理")
@Tag(name = "在做试题管理")
@AllArgsConstructor
public class TakedQuestionController implements TenantCorrelatesAccessCrudController<TakedQuestionEntity, String> {

    private final TakedExperimentService takedExperimentService;

    private final TakedQuestionService takedQuestionService;


    @Override
    public TakedQuestionService getService() {
        return takedQuestionService;
    }

    @Nonnull
    @Override
    public AssetType getAssetType() {
        return KoudaiAssetType.takedExperiment;
    }

    @Nonnull
    @Override
    public Function<TakedQuestionEntity, ?> getAssetIdMapper() {
        return TakedQuestionEntity::getId;
    }

    @Nonnull
    @Override
    public String getAssetProperty() {
        return "takedExperimentService";
    }
}
